<template>
  <SeachTable class="seachTable" :noResetTable="true" :tableType="1" ref="searchTableRef" :forms="tableForms"
    :btnLefts="btnLefts" :btnRights="btnRights" :tableLoading="tableLoading" :tableConfig="tableConfig"
    :tableData="tableData" :totalPage="total" @handlerSearch="handlerSearch">
    <template #activityName="{ row }">
      <span class="activityName" @click="toDetail(row)">
        {{ row.activityName }}
      </span>
    </template>
  </SeachTable>
</template>

<script setup>
import { useCurd, useMyActivityData } from './Hooks/index'

const router = useRouter()
const { tableData, tableLoading, total, tableConfig, btnLefts, btnRights, tableForms, handlerSearch } = useCurd()
const { searchTableRef } = useMyActivityData()

onActivated(() => {
  searchTableRef.value.handlerSearch()
})

const toDetail = (row)=>{
  const name = row.activityType === 3 ? 'NewcomerDiscountDetail' : 'DiscountRestrictionDetail'
  router.push({
    name,
    query: {
      id: row.id,
      view:1
    },
  })
}
</script>

<style lang="less" scoped>
.activityName {
  cursor: pointer;
  color: #3480ff;
  font-size: 14px;
  font-weight: 400;
  line-height: 14px;
}
</style>